using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class SynonimTagMap : EntityTypeConfiguration<SynonimTag>
	{
		public SynonimTagMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.NameValue)
				.HasMaxLength(255);
				
			// Table & Column Mappings
			this.ToTable("SynonimTags");
			this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.MedicalVocabId).HasColumnName("MedicalVocabId");
			this.Property(t => t.NameValue).HasColumnName("NameValue");

			// Relationships
			this.HasOptional(t => t.RefMedicationVocab)
				.WithMany(t => t.SynonimTags)
                .HasForeignKey(d => d.MedicalVocabId);
				
		}
	}
}

